import axios, {ResponseData} from 'yuxin-base/src/utils/axios'

export default {
	/**
	 * 根据bizId获取上传图片信息
	 * @param bizId
	 */
	getPicList(bizId: string): Promise<ResponseData> {
		return axios.request({
			url: `/oss/upload_file/list_pics_by_biz_id/${bizId}`,
			method: 'GET'
		})
	},
	/**
	 * 更新文件信息
	 * @param data
	 */
	updateFile(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/oss/upload_file/update',
			method: 'POST'
		})
	},
	/**
	 * 批量更新文件信息
	 * @param files
	 */
	updateBatch(files: any[]): Promise<ResponseData> {
		return axios.request({
			data: {
				uploadFiles: files
			},
			url: '/oss/upload_file/update_sort_by_id',
			method: 'POST'
		})
	},
	/**
	 * 删除文件
	 * @param id
	 */
	removeFile(id: string): Promise<ResponseData> {
		return axios.request({
			url: `/oss/upload_file/remove/${id}`,
			method: 'POST'
		})
	}
}
